export interface ResponseData {
    code: number,
    message: string,
    ok: boolean
}

// spu数据的ts类型 需要修改
export interface SpuData {
    id?: number,
    spuName: string,
    tmId: number | string, //品牌id
    description: string,
    spuImageList: null | SpuImg[],
    category3Id: string | number,
    spuSaleAttrList: null | SaleAttr[], //销售属性
}

// 数组：元素都是已有spu的类型
export type Records = SpuData[];

// 定义：获取已有spu接口返回的数据的接口类型
export interface HasSpuResponseData extends ResponseData {
    data: {
        records: Records,
        total: number,
        size: number,
        current: number,
        searchCount: number,
        pages: number,
    }
}


// 品牌数据的ts类型
export interface Trademark {
    id: number,
    tmName: string,
    logoUrl: string
}

// 品牌接口返回的数据的ts类型
export interface AllTradeMark extends ResponseData {
    data: Trademark[]
}

// 商品图片的ts类型
export interface SpuImg {
    id?: number,
    imgUrl?: string,
    spuId?: number,
    imgName?: string,
    createTime?: string,
    updateTime?: string,
    name?: string,
    url?: string
}

// 已有spu的数据类型
export interface SpuHasImg extends ResponseData {
    data: SpuImg[]
}

// 已有spu销售属性ts
export interface SaleAttrValue {
    id?: number,
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    saleAttrName?: string,
    isChecked?: boolean,

    baseSaleAttrId: number | string,
    saleAttrValueName: string | number
}

// 存储已有的销售属性值数组类型
export type SpuSaleAttrValueList = SaleAttrValue[];

// 销售属性对象的ts类型
export interface SaleAttr {
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrName: string,
    spuSaleAttrValueList: SpuSaleAttrValueList,
    flag?: boolean,
    saleAttrValue?: string
}


// 全部的销售属性
export interface HasSaleAttr {
    id: number,
    name: string
}

export interface HasSaleAttrResponseData extends ResponseData {
    data: HasSaleAttr[]

}


// sku
export interface SkuData {
    skuDefaultImg: string
    category3Id: string | number,
    spuId: string | number,
    tmId: string | number,
    skuName: string | number,
    price: string | number,
    weight: string | number,
    skuDesc: string,
    skuAttrValueList: [
        {
            attrId?: string | number,
            valueId?: string | number
        }
    ],
    skuSaleAttrValueList: [
        saleAttrId?: string | number,
        saleAttrValueId?: string | number
    ],
}

// 获取sku数据接口的ts类型
export interface SkuInfoData extends ResponseData {
    data: SkuData[]
}

